Remove test code & fix pagination