refactoring partially