added goToMiddle function