Updated to work on Node 0.10+