Fixed memory leaks, added domain-specific filtering