Moved object creation into own method.