Minor refactoring, add misc.make_script_url()
MASSIVE REFACTORING, totally not a NoneType fix