added alert function from scratch