updating comments and adding final optimizations to some code and includes