Added save to xlsx option, refactor