Merge changes from Gauri and added default error handling logic