Implemented pattern state. Closes #14