version comparsion code: ported from old repository, requires review