Incorporated Logging & Fixed encoding errors