Improved selector detection