Updated Javascript class structure