updated refactorization