major model and view refactor