Added parentheses for ? operator
Added import for Exception