(XDK) Implement apply_state_changes