Code refactorization