cleaned some create file logic