working on sod calc code