Moved tag handling to the Filter class