rename and refacting function