image processor more code refactoring