Models and basic event-handler.

Completes #3 and also completes #7.