Added some code to detech if a point is inside a polygon