extract state fetching into method