refactoring + fixed some log errors