updated js script with dynamic height and widths, added some comments, double checked callback functions