Sample code heavily based on the Professional Node JS book and the Secrets of the JavaScript Ninja book