refactored a tiny bit to make collision dection easier