added semi-broken paging functionality