cleaned up hit function