Finished most js and gallery logic