Added events for pattern and stub for couch
Fixed merge pattern.js