Error wiht $model. Need to fix for page functionality