added back some accidentally removed code