refactored to use common