with refactoring code