Add filter fucntion as option so that it can be replaced or customised