updates to make branching and multiplication work properly, plus other bug fixes