ImageController refactoring