completely redone scripting, much simpler; need to update test cases!