Modified to wrap try/except