massive refactoring finalising this task in a satisfying fashion