Changed filtering system, put script into IIFE

Filtering script doesn't rely on timer anymore, which improves performance.