Added error-handling