fixed pagination - small refactoring