Add state-atom function.
Update fun-mode middleware.