refactored out common types