Smart boxing optimization