tidied up formatting, buttons and switch_last_state