Added toast() function and error reporting