Improvment of collision testing

Changed the algorithm to check for box collision.