Move object creation up

Better to have a reference to the object for later.