I don't really know how this works so I might get round to making it useful one day...