Use faraday middleware

This is the solution for ticket #87. It reduces the code a lot, which is always nice.