Perhaps change this into a function to encapsulate collision detection and handling.