Finished main algorithm and tested

Works for files and plaintext. Need to go over all code and check for errors/improvements to fix.