the duplicate code here should be refactored