JS restructurization