Add patterns code