Added a parameter for the number of posts