Cleaned up comments and formatted code