Add support for model packages

Tests and code to fix #7.

Will be merged once working.