alg2

changes to alg2 and the amalgamate function to fix some issues with the
way words were output.