Added additional checks to the collision method. The next step would be to modify the previous collision method, which (as always) just might go wrong