Finished BCTW

Finished recoding BCTW, improved efficiency and memory usage