Pty tinkering

Fix redefine-MOSH-IP issue
Simplify some in the code. Cleanup some left fd's.