moves getopts into function