Added filter function. Ought to work