- use lassign instead of "foreach ... break" idiom
- fix duplicated "and" in query
- use "in" operator instead of lsearch
- add message keys