Stateful approach works now.

Updated to make sure stateful approach works.