Code cleanup and new filter method