Fix: optimize code