Newest function expanded