Move loading.state assignment