break post generation into its own function