Yay, encryption option actually works, got my pointer/value arithmetic mixed up
slight changes to gain setting.