Moved return values to within the try blocks