Quality Check, and Comments

Made sure that the code was consistent.

No quad-space tabs.
Space between if/else/for/while and brackets
No one line ifs, and compulsory {} for all if and elses
Indenting
Variable names