refactored out repeated code