refactored rectangle overlap method