moved hitTest to main file