added terminal + more tests and bugfix