Refactored .each to .collect for the encrypt method