Add environment and patterns
Move tests; add env test
Patterns