Moved lightmap changes into one loop at end