Removing the C-style for loop