Comments

Added comments and reorganized code to be more readable