added method gotoPage(), refactoring to fir new needs