Getopts and more error checking.