Cleaner Code

Cleaned up the code for efficient booleans and improved comments.