Implemented a faster and more accurate collision detection algorithm