refactor/validate patterns and tests