Added the initial packet encoding routines.