Next pass at proper gallery JS