added writeTable