More graceful error checking
merge conflicts???!
fix main error checking