Separate out update_state

Two functions: one for updating wakeup tree, one for just normal runs