added trim function
added automatic daily saving