Refactored patterns module into submodules