better aes code structure