Optimization, use lookup instead of select