moves the try/catch outside

let’s avoid unnecessary nested indentations
code makeup
Merge pull request #1 from olistik/master

Refactors a bit