refactoring + fix