merged with refactoring changes