start of post processing function