Removing superflous enumerate() calls