Added try/catch with variable alert