reeeefactor, based on jbuck's node-express advice