refactored and working
bug fix by recognition of mouisure increase