Made encryption more generic