The code looks good. If it is reporting too much elevation gain/loss then I guess I have to agree with you that it is do to adding elevation errors while you are standing around.

You could skip points with small distance changes, what might be better would be to skip points where the elevation is greater than the distance change. That would be walking up a slope greater than 45°. I guess anyway you do it, you might have to play around with the limits on your filter until you get good results.