Made application add to work, fixed some bugs