functional.  gave correct output from original question example input.