improved note bin packing algorithm