use pipes instead of < <(..)
add -x/-e to grep calls
fix edge cases in -o/-c flags
make urxvt pass the app test
move some functions and add some comments