Deleted extra code. Fix some defects.