add scope detection