Feature/make robust

Various improvements for robustness and performance.
This change was run by John?