Fixed main JS structure. Next : clean unused dependencies

Signed-off-by: Tyloo <jbonva@gmail.com>