not strictly correct; I'm just working on making it work on scripts