Simplify code, add check for conversions.