Refactor command line convert code to new file (main.cs is way too big...)