Added upgrade, activation and deactivation methods and hooks.