elima's commits from work on pack.c