first implementation of pagination - not finished yet