.loom file generation algorithm