handle repeating chars; use function composition; better tests