Study reveals how brain’s internal compass works