[Mostly correct,but still need check,by Steven]