cleanups. fixed the output encoding. removing useless code