Added comments and formatted code well