refactored conversion