my implementation of scope testing