Refactored out error handling into method (lines 16-20)