more refactoring: command line args now handled in a separate module