Added sorting to post generation