Moved var declaration into try {}