Some minor rework, mainly on the unit tests