refactored BugGame.js