rewrite checkHit function