Merge upstream changes from square/dagger

Most notably, square/dagger#389, and also doing it as a proper merge, rather than a rebase, to ease future merging.