Initial commit of working pagination, refactor and code hygeine to follow