Implementing the flood protection. Fixed #2