rewrite logger; cleanup