Changed Write Function