Started commenting the code and better formatting
Merged Arturs code in