Conditional selection based on layers