added states. reordered text to make it easier to scan.