Added more advanced collision detection to polygons