Replaced pipelined map with Enum.into/3
Refactored to use reduce and an internal exception to bail out on invalid input