Split request func for easier testing