Added sample server.js, rewritten error handling in module