implemented moving forward and backward