add then and write case