State machine to control fetching