further refactorization