Adding combined function, need help debugging