Corrections to local mass definition, seems to be working but hasn been tested with examples.