appvar from scratch