modified argument handling to use getopts