update to masonry javascript code