removes unneeded nested loop in ui