Updated Treatment algo, now more efficient and easier to understand.