tetra/core/scripts: refactor to be more readable