refactored into repository package