Added pattern parameter
Bug fix
A little more PG