packThings remWeight (x@(_,weight,_):xs) =
    (if weight <= remWeight then
        let packages = packThings (remWeight - weight) xs
        in map (addThing x) packages
    else []) ++ packThings remWeight xs
packThings remWeight (x@(_,weight,_):xs) =
    (if weight <= remWeight then
        let packages = packThings (remWeight - weight) xs
        in map (addThing x) packages
    else []) ++ packThings remWeight xs
packThings remWeight (x@(_,weight,_):xs) =
    (if weight <= remWeight then
        let packages = packThings (remWeight - weight) xs
        in map (addThing x) packages
    else []) ++ packThings remWeight xs