saving to file, ugly way