Another attempt to handling impure state.