moving to a more stateful approach