fix pagination, refactor views, controoller, lib