Made templating work, rearranged server file to keep difference between data base stuff and server stuff.
Fixed race condition, and upgraded error handling
Merge pull request #1 from GabeLoins/vqtran-fix

Templating (ejs-locals), server file style.