Added Error handling.