fixed minor border cases, added assertions; BCH passes tests for varying word size. TODO: consider TED and CRC code on top