started some additional error checking
more error handling and troubleshooting