Added wait and write