Use scala idomatic way of handling failures