Removed redundant for loops