Working collision detection. Needs improvements