refactored patterns layout