Move stack manipulation code from util.c to new file stacks.c.