Enhanced getPosts() method. (Fixed typo)