Refactor error hnadling into a function
Remove old error handling that is no longer required
Remove unused imports
Remove the now unused SSL backport code