clean up and add checks in pagination mixin