generalized goToView function