Instead of nesting try, maybe create an helper function?