working refactorization