Substitute alert messages in callback functions with console.log