pulled the model code from the sample out into its own library, possibly for future release