checkRight function completed