Cleaned up the argument parsing a bit.