More functional programming for abstraction