Fix javascript structure