Functional version of the state interface