changed temp to update onStateChange