Update to work with HTML5 player

Clean up code
Change spaces into tabs