refactor the code of the watering system