added more error handling and clearer instructions