Added bag searching function