Trying different file writing approach