Added error-handling.