move pty handlers into util. has slight disadvantage in that previously extended fd with new methods but now effectively has new type. May work on variation of this