DOS protection added

Needs tested