Added beginnings of combined code