Refactored unit hydrograph code