Implement basic state switching.