Added more error handling, and also stripping execess whitespace from dot, and outputing as plain texT