Clean up encoding