finished building newEncoder (with multipleTerminations) TODO delate old things and test it