refactored out private methods