here is the latest file with algorithms which appear to be working.