refactoring&debuging