Changed try/except portion to a simple if statement