Added error checking. Updated README.