Added comments. Removed unused code.

Added comments for readability and removed unused code.