Check if command line also includes 'serve'. Move command line processing logic into a helper function.