Reduced the code size

Removed all the unnecessary comments and reduced some if statements to a
more elegant version