wow, it almost worked straight off. fix getopts syntax