Fix: remove duplicate code