refectoring, change function name and order