implements getopts