Corrected a bug with getopts and re-added the '-d' option with device/action argument