Refactored the conversion process and fixed #39