changed autotagger to pass around document element rather than global, this improves access when autotagger is a module