Initial import

Script is already useable. Limited testing has been run on it, but it
seemed to work pretty decently.