updated functions to same file from petsc