Fixes to remove unnecessary loop