Adding function and alert box