Merge remote-tracking branch 'origin/declan' into paul
Added isBefore, isAfter, isEqual
Tweaked to retain reference to Document object outside primary loop.

Signed-off-by: Nathan T Freeman <nathan.freeman@redpilldevelopment.com>