Try using `Peekable`/`peek` instead of `enumerate` and `take`.