ported from Mnemosyne