Remove a ton of cruft in favor of the much simpler techniques invented by github user kazimuth.