Introduction packet transformer and some refactoring