first pass at a solution for space-age exercise.
Create onFoo() function implementations dynamically