main code for post processing