Refactored sample application to follow couchnode code guidelines and
moved some non-couchnode related functions to 3rd party libraries to
make the code easier to read.