Add dict_by_attr, remove dead code, fix searching