adding interRect function