Main now catches exceptions (fixes #4)