Re-adjusting javascript structure.