Remove unnecessary loop and just do a direct assignment instead