cosmetic: simplify jacobianHelper, hessianHelper and sparseHelper functions and fix spacing in dynamic file