moved function back to where it was (in loadPosts))