david's integrated code