Here is the combined code