added rectangle overlap detection algorithm