add a docstring for _isTerminal
delete some trailing whitespace
add a missing word