Updating JavaScript class snippet