Fix encryption; refactor Key