Factor out convert