this version is tested and seems to work OK.