Added error handling and displaying capability