This should be moved outside the try block