Maded some code revisions (untested). Added a a separate function for mainting the linked list of encrypted blocks