modified to work without a PHP backend just as a standalone js library