amalgamation and alg2

Amalgamation now seems to run through without problems but I can't
guarantee that it always gives the correct results. Alg2 is mostly there
now but still has some problems with warning messages, possibly just
left over from tests in other functions though.