split up collision detection by adding a test function