Adding queries

FIrst attempt at state machines; states, transitions and queries.
Added interface for Model.