That is exactly what I do: set an stomic variable and do yhings outside of the handler.