Changed to console.log and closures

Update to nodejs and closures.