Code Commenting / Optimization

Code fully commented, and some parts optimized.