Better state diagram