More tidying up/refactoring