refactoring: use range-based for, remove pack() and pack2()