Add forgotten template
Do permission checking; allow title editing

Also refactor some things