Add encrypt function. Minor changes.