Slight refactors and tidying up