upgraded algorithm and fixed words