minor changes: extract assert function from model, create assert.js
minor changes: use prototype to define internal methods