updated code with comments, and commands now executed child process exec and fixed error in example.