Added collision detection
Improved collision detection by handling move one axis at a time