code cleanup, added query params, started pagination