Concentrated base defense logic in one place

Removes code duplication.