Modifed Http connection code