re-arranged everything to modularize it for use in other (node) projects