replaced state argument with more versatile options argument