refactoring - 6j control structures