Removing a lot of redundant code around HTTP usage