Changes entered while troubleshooting.
Lots of additions to handle error situations.