major rewrite using model objects