refactored conversion to use shared functions