it's too bad we don't have `gen.state` that could make this a bit nicer, hmmm