Added a bit of statefulness.