error handling and docu corrected.