Here lies a bunch of code I wrote one evening which almost worked really well