refactored initfortest