refactoring postsData and posts