modify minor code according to michael