refactoring Quaternary3, adding quaternary tests, formatting
formatting code and organizing imports