posts.js refactor pt1