Rewrote model for more flexibility