Extensive source reformatting.

Created factory to handle filtering.

Eliminated a silly NPE error that occurred if I had a selection dialog
open, then selected quit, and exited.