Fixed gallery function