Extracted the img replacement into a plugin