added deactivate logic