Removes useless logging; tidies up code