Add timeout method and update example.js to work with node 0.8. Closes #2