Moved the bulk of code in onEnable to separate methods.