Put try catch to make sure inputs are valid