removed old functions, fixed post pagination, optimised queries for post relationships