added alert handling