fix collision detection and remove unused files