Added error checking and flash error display method