AC version with global vars