added filtering function, minor changes