a bit rewriting js(structure)