Added optional state argument.