Merged some init and build packet functions