modified extractDetails() to include doc properties in template context

added some tests around lib/messages.js also