Switch to records for barriers, add type hints.