Updated: used contains() in place of (corrected but commented out) itr2 in processCommand()