Improve coercion code