Added intersection testing function.