Manually revert all changes made after debefa8b98d so that the code proposed in #131 gets a proper review.