forward and backward method working