encrpytion and syncing keys working with some periodic bugs