add a function for reorder and some comments