finish adding all template and model functionality