Fix: optimization, only one loop