added doc creation
moving exceptions
added error handling for doc creation