refactoring, and making Quaternary more consistent with Binary and Ternary (e.g. implementing LaTeX)