a little bit of functional programming