Work on pagination, code clean up