Using shared_ptr inside filter class. Added frequency check