Work in progress on fixing up model.js and PM