cleaned up code, separating filters (eg threshold) into sepearate file