new functions but no comments, begin of analyse loop, working on saving file