- added some error handling