added mode option to aes