Further refactoring in order to make protocol stacks independent