Added guarded function.
Basic State Monad.