Small refactoring and basic command line options support