Most write functions working