added a rescue clause to prevent syntax errors from messing everything up