added more functions like paging etc