close #3
use console.log instead of stdout.write