modified encryption function for easier customization