moved player logic into a separate file + cleaned some code and removed jslint warnings