Refactoring convert functions.