add helper functions and separate test env