#50 Fixed bugs in game logic and tested it out with chrome and firefox
#50 Refactored javascript code and provided some javadoc comments.