Added plotting function written by Lee.
Changeed the way the filter function is called.