more efficient gallery