Restructuring classes Key and Encryption