added terminal_test and utility func untested