simplified transition function by using fromMaybe.