Single-mode js moved to separate file. Update_typing_state and final dialog implemted.