remove duplicated code and give a more clear name