Removed unnecessary loops