refactoring to match master branch