merged state monads into one, simplified structure and examples