Cleanup of pack.c and added pack.h. Partial commit.