Do special cases with foldLeft
Add checking for illegal characters and ordering