Added better exception handling and error checking