Some code refactorization.