refactored cia code

an attempt make errors in tik/tmd values rarer in occurence
bug fix

prevented cia from "decrypting" cleartext ncch images
Merge pull request #13 from 3DSGuy/unstable

refactored cia code & fixed bugs