Refactored generic marker rewriting into a separate object.