separate thread for storing