updated the function and changed database