recreating code lost from merge