logging, encoding clean up