Some fixes (for example not loading the page if pgCurrent == pgCount) and Cleanups