Added better error handling for error 401 (unauthorized) also started on adding an operation