merging back nicola's work