Copied stuff from tetris