example code of node cookbook: http://www.amazon.com/dp/1849517185