Refactoring using Guzzle