Improved robustness & tidying up