Major refactor of ignore code.  Fixes #168.  Fixes #127.