new worker functions & minor tidying

new encryption worker functions ported from snc for cc