Move conversions to function