Misc

Add new waitpid routine to wait for children (with trivial bugs)
Add debug code