Fixed most of the comm bugs, and fixed the gradient as well.