update state based on returned data