Got rid of underscore's contains, extends, and omit
some unnecessary uses of flatten