Made alert into a function.