refactored game into one js file