Refactoring + fix