added pattern support