Minor changes in snippets, added invalid declarations check and minor pattern fix