Cleaned some code, added repeated multidim. differentiation