Re-architected version.