Added major improvements to collision detection