An ingestible pill includes a coating configured to dissolve in a small intestine a core, which includes a medication-delivery element, which (a) has a compressed shape when disposed within the coating, and (b) is configured to assume, after the coating dissolves, an expanded shape a medication and a mucoadhesive. When unconstrained in the expanded shape, the medication-delivery element (a) is shaped so as to define first and second surfaces on opposite sides of the medication-delivery element, which have respective outer perimeters, which surround respective spaces of the respective surfaces, which spaces have respective greatest dimensions equal to between 2 and 10 cm, and each of which spaces has an area equal to at least 50% of the square of the greatest dimension and (b) has an average thickness between the first and the second surfaces of less than 6 mm. Each of the medication and the mucoadhesive at least partially coats the first surface.