Makes filter function work with data. Also cleans up some unnecessary code and better formatting.
Merge pull request #98 from teem2/replication

Makes filter function work with data.