Added collision detection and valid moves