Added first parts of editing and fixed some template bugs