smoothing code added lots of soplns commented for now