Added my attempt with exception handling
Merge pull request #2 from kmooney/master

My attempt...