Horribly messy script for automating refactoring stuff.