Added hysteresis code (Neil Martin's version fixed and simplified)
Merge pull request #2 from fsantini/mlaws_2

Hysteresis code (Neil Martin's version fixed and simplified)