about to try to make it into a module, revert to here if you fuck it up badly