improved water distribution algorithm