Full rewrite of the module.

Dropped all defines in favor of configuration files
Rewrite to new base
Updated testing