wrote crop function
made inBounds function accept rectangular areas