Factor out Writer element from the State monad