1. Add try catches in a few places.
2. Fixed regular expression issues.