Minor refactoring & tidy up