options processing, could be done better using getopts