Separate the creation of the object into a function.