Added the ajax for the periods, it crashes on adding/removing though