Added some collision handling code