started commenting all code and changed var declarations to one local statement