Pagination ready. many minor stuff to fix yet