Refactor CommandLine Code to match existing code for extensiblity