Rewritten for new structure.