Updated getopts code