Added a --deactivate flag and restored original functionality