refactored image processor