Revert "Removed old initialization code from erd_depth, which is no longer necessary and actually quite dangerous (uses uninitialized values)"

This reverts commit 7448a8dab4c7a88b97c276b0c5282e92bba82dfc.
Revert "Revert "Removed old initialization code from erd_depth, which is no longer necessary and actually quite dangerous (uses uninitialized values)""

This reverts commit a06d279da608c1428d7ee772648922f1c1541d49.