Added comments. Removed unused segments of code.