State pattern exercise