write main