model oop

flat.js still has errors