Added function for checking if point is inside rectangle