Removed unnecessary loops.