Basic filtering functionality

Still has a few bugs