added some terminal wrapper code