adding source support

This adds support for source filtering as I suggested in #365.