Improve role activation code