added alert to function