Refactor/organise refinements and code tidying