Added custom selection checking