Fix row removal bug and refactor collision detection to a separate class