Added error handling;