Rewrote collision detection two times (+ some minor changes)