corrected refactorization mistake