adding when-connected stuff