overhauled waitpid, exiting and process reaping