Added help function and code optimizations