Some refactorization