created apply_filter function. Now to put it to use