Added getopts function