Added display_state booleans and some error checking