Fixed pagination and some other minor bugs