ADD ids in write function