Added ability to set and run patterns