Bivalves (Class Bivalvia) are a very diverse group of molluscs characterised by having two shells that enclose their laterally flattened body. The shells are joined at the margin by a ligament, and have hinged teeth. Two adductor muscles attached to the shells can close them tightly for protection, or to prevent desiccation. Most bivalves are filter feeders, pumping water across the highly modified gills to filter out food particles. Bivalves are well adapted for living in soft substrata such as sand and mud, although some bivalves attach to hard substrata or bore into rock, coral or wood. Most species have separate sexes and shed eggs and sperm into the water for external fertilisation.