Functional programming to the rescue