Hacked a rough solution to problem of modal state.