Added first version of when() to the model, updated unit tests
Updated docs