refactor, stabilize main/child process