implemented flood logic