performace refactor