A state diagram example