more documentation, PTY API cleanup