Refactorings and more robustness.