dry'd all the wet code and fixed output encoding