Clean up the final catch function so the code isn't as crowded.