imagerepository refactoring