Later on we could improve the situation by making state a case class so that carrying all the state around is not annoying :)