refactored repository