moving pagination, getting sort and page dynamically, fixing bugs after refactor