updated sub-routine