edited the function