revert last one, need to refactor this function 1st