minor refactorization