Added more defense against floods. Also wrote (untested) a dc detector based on a timer.