Refactoring convert method