implemented some collision handling