CODE: Numerous simplifications and refinements to increase robustness
FIX: Several crashes