some codes to help learning ldd3