added paging support, and few another changes