Added minimal error handling, although error messages have not been added to the view yet.