Write state updating functions.
Update monad
Define patches clearly