Add NewDocument initialization function