Error handling implemented and tested now.