work on #6: model function implemented.

Test cases are missing - this should be done next!