loose this function. And modify the one above as explained.