Improved panel selection logic