Improve readability with case statement.  Use map instead of recursing manually