Refactoring, split up doing request part into a common function