More refactoring + tests coverage