refactored the tetris.js