cleaned up the .encode parts