Refactored selectAttribute action