put the post processing into one function