updated filtering code

rewrote filtering code to allow for user input
code only filters on single string at the moment (still needs updated).