Attempt at functional style, not successful

Next time lets try to just make it work...