updated the routine