better pagination, some bug fixes