Modified dbn code