baseconvert refactoring