update expand.R
organisation and some comments