Added comments and organized lines for readability