Add code to Control encrypt function