lots of refactoring, added enable/disable