finished implementing terminal api call

random seg faults :(
needs debugging