Last occurance function put in utils