Refactor enable/disable code and add docs
Resolve compile issues