Building context

Following the better error management branch, this one extracts the buildContext method into its own module (preliminary work, more todo), allowing good testing for the better error management