added getopts for argument parsing