updated with new javascript structure