changed so runtime uses state flags