added functional programming stuff