Move ackCallback generation into its own named function