final working bin packing solution with comments