changed the recursion to load posts to a while loop