added pattern expansion