use local var for state