small refactoring using util.Try