Substantial Blockterms Codec porting & additional clean up