Reorganize order of functions