Using functional programming for push and pull