updated core output clean up code