Accept directed graph input data from STDIN.
Remove useless 'handle' variable
fix a variable scope problem