refactorization - still needed for tests